class People:
    def __init__(self, weight, height):
        self._weight = weight
        self._height = height

    @property
    def bmi(self):
        # 体重指数公式改为 正确的公式
        return self._weight / (self._height ** 2)

    @bmi.setter
    def bmi(self, value):
        print('改属性值不可更改')

    @bmi.deleter
    def bmi(self):
        print('改属性值不可删除')

    @property
    def weight(self):
        return self._weight

    @weight.setter
    def weight(self, value):
        self._weight = value


jmz = People(66, 1.75)
print(jmz.bmi)  # 计算 bmi
jmz.bmi = 12  # 尝试修改 bmi 自动调用对应方法
del jmz.bmi  # 尝试删除 bmi
print(jmz.weight)
jmz.weight = 100
print(jmz.weight)
# 输出:
# 21.551061224489797
# 改属性值不可更改
# 改属性值不可删除
